-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
GH-128914: Remove all but one conditional stack effects #129226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-128914: Remove all but one conditional stack effects #129226
Conversation
|
Note: Prior to this change, monitored calls would see With this PR, monitored calls will see |
|
Performance for free-threading is about 1% slower, mostly attributable to the Richards benchmarks. Which suggests to me that the change to |
|
I needed to effectively revert the change to |
|
Performance is neutral on the default build. Free-threading shows a 1% slowdown which makes no sense given the stats and code changes. |
|
Conditional stack effects fall into three categories:
NULLifoparg & 1_PyObject_GetMethodifoparg & 1This PR:
_PUSH_NULL_CONDIITONALthat pushesNULLifoparg & 1and uses it in all instructions that pushed NULL conditionally, so that those ops no longer have conditional stack effects.LOAD_ATTRto useself_of_null[oparg & 1] instead ofself_or_null if (oparg & 1)`. This has no meaningful change on the generated code, so no impact on the interpreter. It will force the JIT to spill any registers, but we expect all jitted code to be specialized anyway.BUILD_SLICEto use an array of args. GiveCALL_FUNCTION_EXhas a fixed stack effect by and pushingNULLin the compiler when**kwargsis not defined.A future PR will remove support for conditional stack effects and the
splitannotation.